# Typical laptop setup, with wifi, brightness, battery etc, for
# i3/Sway.

# For X11/i3, you'll want to replace calls to swaymsg with i3-msg, and
# the sway-xkb module with the xkb module.

# fonts we'll be re-using here and there
awesome: &awesome Font Awesome 6 Free:style=solid:pixelsize=14
awesome_brands: &awesome_brands Font Awesome 6 Brands:pixelsize=16

std_underline: &std_underline {underline: { size: 2, color: ff0000ff}}

# This is THE bar configuration
bar:
  height: 16
  location: bottom
  spacing: 5
  margin: 7

  # Default font
  font: Adobe Helvetica:pixelsize=12

  foreground: ffffffff
  background: 111111cc

  left:
    - river:
        title: {string: { text: "{seat} - {title} ({layout}/{mode})" }}
        content:
          map:
            conditions:
              ~occupied: {empty: {}}
              occupied:
                string:
                  margin: 5
                  text: "{id}: {state}"

  right:
    - removables:
        anchors:
          drive: &drive { text: , font: *awesome}
          optical: &optical {text: , font: *awesome}
        spacing: 5
        content:
          map:
            conditions:
              ~mounted:
                map:
                  on-click: udisksctl mount -b {device}
                  conditions:
                    ~optical: [{string: *drive}, {string: {text: "{label}"}}]
                    optical: [{string: *optical}, {string: {text: "{label}"}}]
              mounted:
                map:
                  on-click: udisksctl unmount -b {device}
                  conditions:
                    ~optical:
                      - string: {<<: *drive, deco: *std_underline}
                      - string: {text: "{label}"}
                    optical:
                      - string: {<<: *optical, deco: *std_underline}
                      - string: {text: "{label}"}
    - network:
        name: enp1s0
        content:
          map:
            conditions:
              ~carrier: {empty: {}}
              carrier:
                map:
                  default: {string: {text: , font: *awesome, foreground: ffffff66}}
                  conditions:
                    state == up && ipv4 != "": {string: {text: , font: *awesome}}
    - network:
        name: wlan0
        poll-interval: 1000
        content:
          map:
            default: {string: {text: , font: *awesome, foreground: ffffff66}}
            conditions:
              state == down: {string: {text: , font: *awesome, foreground: ff0000ff}}
              state == up:
                map:
                  default:
                    - string: {text: , font: *awesome}
                    - string: {text: "{ssid} {dl-speed:mb}/{ul-speed:mb} Mb/s"}

                  conditions:
                    ipv4 == "":
                      - string: {text: , font: *awesome, foreground: ffffff66}
                      - string: {text: "{ssid} {dl-speed:mb}/{ul-speed:mb} Mb/s", foreground: ffffff66}
    - alsa:
        card: hw:PCH
        mixer: Master
        content:
          map:
            conditions:
              ~online: {string: {text: , font: *awesome, foreground: ff0000ff}}
              online:
                map:
                  on-click: /bin/sh -c "amixer -q sset Speaker unmute && amixer -q sset Headphone unmute && amixer -q sset Master toggle"
                  conditions:
                    muted: {string: {text: , font: *awesome, foreground: ffffff66}}
                    ~muted:
                      ramp:
                        tag: percent
                        items:
                          - string: {text: , font: *awesome}
                          - string: {text: , font: *awesome}
                          - string: {text: , font: *awesome}
    - clock:
        time-format: "%H:%M %Z"
        content:
          - string: {text: , font: *awesome}
          - string: {text: "{date}", right-margin: 5}
          - string: {text: , font: *awesome}
          - string: {text: "{time}"}
    - label:
        content:
          string:
            on-click: systemctl suspend
            text: 
            font: *awesome


